<?php

class Model_activity extends CI_Model {
	
	public function get_top_parking($uid) {
		$query = $this->db->query('select na.auth_id, a.name,sum(na.period) as total from not_available na inner join authorizations a on na.auth_id=a.auth_no where na.user_id="'.$uid.'" group by na.auth_id');
		return $query->result_array();
	}
	
	public function get_latest_activity($uid,$utype) {
		if($utype==0) {
			$query = $this->db->query('select * from user_activity where user_id='.$uid.' and datediff(now(),end)<7 order by start desc');
		} elseif($utype==1) {
			$query = $this->db->query('select * from user_activity where user_id='.$uid.' and datediff(now(),end)<7 order by start desc');
		}
		return $query->result_array();
	}
}